home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 4.1 KB | 117 lines | [TEXT/GEOL] |
- Item 8391545 16-Nov-87 16:07
-
- From: D0830 Data Translation, Dev, R Burger
-
- To: MACAPP$ MacApp Interest List
-
- Sub: Response to C+MacApp Cross Dev
-
- Happiness = MPW C + Pascal + MacApp
-
- I recently tackled the problem of integrating MPW C code into
- our MacApp/MPW Pascal programming environment and came up
- with what I believe is a fairly clean solution. There are
- lots of subtle issues to deal with, but all you'll need do
- is modify a few of MacApp's make files and you'll be automatically
- MABuilding complete C+Pascal+MacApp applications within minutes.
-
- To the MacApp.make1 file in 'MacApp Make Files':
-
- 1) Change the .p.o rule near the bottom of the file to read:
-
- .p.o ƒ .p
- echo Compiling {default}.p
- Pascal {depDir}{default}.p {Debugging} {PascalOptions} ∂
- {POptions} {Search} -d qNeedsROM128K={NeedsROM128K} ∂
- -i "{SrcMacApp}" -k "{LoadMacApp}" -o {targDir}{default}.p.o
-
- I have added the {POptions} and {Search} strings to allow the
- specification of additional Pascal compilation options (such as
- -mc68020) and a .p interface file search string.
-
- 2) Add the following .c.o default rule to the bottom of the file:
-
- .c.o ƒ .c
- echo Compiling {default}.c
- C {depDir}{default}.c {COptions} {Search} -o {targDir}{default}.c.o
-
- This default rule will handle automatic compilation of C files
- for you. Of course, you'll have to add additional dependencies,
- like header dependencies, yourself in {YourApp}.make.
- Again, the {COptions} string is for C compilation options and the
- {Search} string is a search path for #included .h files.
-
- To the MacApp.make2 file in 'MacApp Make Files':
-
- 1) Change the order of object files in the Link command to:
- "M{AppName}.p.o" ∂
- "U{AppName}.p.o" ∂
- {OtherLinkFiles} ∂
- "{ObjMacApp}MacAppLib.o" ∂
- {NeededSysLibs} ∂
- {LinkDebug}
-
- This is important. MacApp applications use a Pascal main routine.
- In order to link C subroutines into the system, the Pascal main
- routine must be linked BEFORE CRuntime.o, part of {NeededSysLibs}.
-
- 2) Add '-w' to the Link command, or you'll see a lot of
- duplicate symbols.
-
- To the MacApp.opt.make2 file in 'MacApp Make Files':
-
- 1) Change the order of object files in the Link command to:
- "M{AppName}.p.o" ∂
- "U{AppName}.p.o" ∂
- {BuildingBlockObjs} ∂
- {OtherLinkFiles} ∂
- {MacAppObjs} ∂
- {DebugFiles} ∂
- {NeededSysLibs} ∂
- {LinkDebug}
-
- 2) Add '-w' to the Link command.
-
- To {YourApp}.make file(s):
-
- 1) Define special C compilation options in COptions, as in:
- COptions = -mc68020 -mc68881
-
- 2) Define special Pascal compilation options in POptions.
-
- 3) Define the search path for .h header files and .p interface files in
- Search, as in:
- Search = -i "{MPW}Display:" -i "{MPW}Support:"
-
- 4) Define NeededSysLibs as follows:
- NeededSysLibs = ∂
- "{CLibraries}StdCLib.o" ∂
- "{CLibraries}CSaneLib.o" ∂
- "{CLibraries}Math.o" ∂
- "{CLibraries}CRuntime.o" ∂
- "{CLibraries}CInterface.o" ∂
- "{Libraries}Interface.o" ∂
- "{PLibraries}PasLib.o"
-
- If one of more of these libraries is not needed for the link,
- you can remove them if you wish.
-
-
- That's all there is to it. While I may not have covered all the
- bases with these fixes, I've been quite happy with the way things
- have been running so far. And it WORKS, which is always an
- important consideration.
-
- Of course, there are lots of issues in integrating C and Pascal
- code (lots and lots and lots), and you won't be able to pass
- messages to objects in C, but that's another story...
-
- I hope these updates help. Send me your problems or comments.
- I can't guarantee that the above changes will work with anything
- besides MPW v2.0 and MacApp v1.1.1.
-
- Roberto Sierra
- Data Translation, Inc.
-
-
-